home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
002
/
chedit.arc
/
CGRAPH.C
< prev
next >
Wrap
C/C++ Source or Header
|
1986-07-23
|
2KB
|
73 lines
/*
This program is placed in the public domain by its author, William Couture.
Copyright (c) 1986 by DDI. All Rights Reserved.
*/
int readcset(shapes,fname)
unsigned char *shapes;
char *fname;
{
int charfile;
/* NOTE: a file stream is not used, as it is possible that
the byte being read from the file is a 26, which is an
EOF mark (ctrl-Z). Make sure that this routine is
compatible with your compiler. */
int i,ch;
charfile = open(fname,0); /* open as read-only */
if (charfile == -1)
return(-1); /* if it cannot be opened, return error */
read(charfile,shapes,1024); /* read it */
close(charfile);
return(0);
}
int writecset(shapes,fname)
unsigned char *shapes;
char *fname;
{
FILE *charfile;
int i,ch;
charfile = fopen(fname,"w");
if (charfile == NULL)
return(-1); /* if it cannot be opened, return error */
for (i = 0; (i < 1024) && ((ch = fputc(shapes[i],charfile)) != EOF); i++)
;
fclose(charfile);
if (ch == EOF) /* if EOF encountered, return error */
return(-1);
else
return(0);
}
void printbanner(row,col,msg,length,color)
int row,col;
int *msg;
int length,color;
/* display a row of graphics characters */
/* Adding 128 (0x80) to the color will XOR draw the characters on
top of the existing screen */
{
int i;
i = 0;
while (i < length)
gratchar(row,col++,msg[i++],color);
}
void printcolumn(row,col,msg,length,color)
int row,col;
int *msg;
int length,color;
/* display a column of graphics characters */
/* Adding 128 (0x80) to the color will XOR draw the characters on
top of the existing screen */
{
int i;
i = 0;
while (i < length)
gratchar(row++,col,msg[i++],color);
}